<!DOCTYPE HTML>
<html>
<head>
<include file="Public/head"/>
<style>
.search_li a {
  width: 27%;
  height: 40px;
  color: #fff;
  font-size: 16px;
  background: #FF6633;
  border-radius: 0px;
  border-bottom-right-radius: 5px;
  border-top-right-radius: 5px;
  border: none;
}
</style>
</head>

<body>
<!--top-->
<include file="Public/header"/>
<!--top end-->
<div class="col-new-add">
<div class="new_property_add a-e-i"><img src="__ROOT__{:get_cover($bg['bgpic'],$field = path)}"/></div>

<div class="container">
    <div class="form-group search_li">
        <form action="{:U('Property/search')}" method="post">
      <input name='title' type="text" class="form-control" placeholder="最新樓盤">
      <button type="submit" class="btn btn-default">搜索<i class="fa fa-search search_ico"></i></button>
        </form>
    </div>
    <div class="estate_li">
       <div class="estate_title">快速搜查房產</div>
      <div class="estate_select estate_select_1">
          <form id="search" action="{:U('Property/searchs')}" method="post">
              <p class="select_title"><span id="add">所在地</span><i class="fa fa-angle-down search_ico"></i></p>
        <input type="hidden" name="add" id='place_num' value=""/>
        <ul class="search">
       
          <volist name="search1" id="data1">
                 <li name="add" onClick="$('#place_num').val('{$data1}')">{$data1}</li>  
          </volist>
        </ul>
      </div>
      <div class="estate_select">

        <p class="select_title"><span id='housestype'>物業類型</span><i class="fa fa-angle-down search_ico"></i></p>
        <input type="hidden" name="housestype" id='type_num' value=""/>
        <ul class="search">
  
          <volist name="search2" id="data1">
                 <li name="housestype" onClick="$('#type_num').val('{$data1}')">{$data1}</li>  
          </volist>
        </ul>
      </div>
      <div class="estate_select">
        <p class="select_title"><span id='sell'>租/售</span><i class="fa fa-angle-down search_ico"></i></p>
        <input type="hidden" name="sell" id='rental_num' value=""/>
        <ul class="search">
     
          <li name='sell' data-type='2'  onClick="$('#rental_num').val('2')">出租</li>
             <li name='sell' data-type='1'  onClick="$('#rental_num').val('1')">出售</li>
        </ul>
      </div>
      <div class="estate_select estate_select_4">
        <p class="select_title"><span id='houses_prices'>價格範圍</span><i class="fa fa-angle-down search_ico"></i></p>
        <input type="hidden" name="houses_prices" id='price_num' value=""/>
        <ul class="search">

           <volist name="search4" id="data1">
                 <li name="houses_prices" onClick="$('#price_num').val('{$data1[0]}-{$data1[1]}')">{$data1[0]}-{$data1[1]}</li>  
          </volist>
        </ul>
      </from>
      </div>
    </div>
  </div>
</div>
<div class="new_property">
<input type='hidden' class='current_page' />
	<input type='hidden' class='show_per_page' />
  <div class="container col_new_li"> 
 <foreach name="all" item="data"><div class="row col-rantal">
        <a href="{:U('Property/detail','id='.$data['id'])}"><div class="col-md-4 col-sm-5 new_img c-e-i"><img src="__ROOT__{:get_cover($data['photo'],$field = path)}" /></div></a>
    
      <div class="col-md-8 col-sm-7">
        <div class="new_property_title"><a href="Details_Property.html">{$data['title']}</a>
            <if condition="$data['sell'] eq 0">
            <span class="col-title-icon">出售</sapn>
            <else/> <span class="col-title-icon">出租</sapn>
            </if>
        </div>
        <div class="new_property_btn">
            <notempty name="tag">
                <foreach name='tag[$key]' item='datas'>
          <input type="button" value="{$datas}" class="btn-{$key+1} btn tag" />
          
              </foreach>
            </notempty>  
        </div>
        <div class="new_property_font">
               <if condition="$data['sell'] eq 0">
              <div class="price_title">出售價格：</div>
            <else/>  <div class="price_title">出租價格：</div>
            </if>
        
<div class="price">{$data['price']}</div>
          <div class="price_right"></div>
          <div class="price_bottom">首付{$data['pay']}起　{$data['size']}平方呎</div>
          <a href="{:U('Property/detail','id='.$data['id'])}"><input type="button" class="price_btn" value="詳細資料"/></a>
          
        </div>
      </div>
    </div>



  
</foreach>
    </div>
  </div>

<!--page_btn-->
 <div class="page col-md-12">
    {$_page} 
    </div>

<!--page_btn end--> 
<!--footer-->
<include file="Public/footer"/>
<script src="__PUBLIC__/Index/js/jquery.cookie.js" type="text/javascript"></script>
<script>
     $('.nav_top li').removeClass('cur');
    $(".nav_top li:eq(1)").addClass('cur');
$(function(){
    
    $('#add').html($.cookie("add"));
    $('#place_num').val($.cookie("add"));
     $('#housestype').html($.cookie("housestype"));
    $('#type_num').val($.cookie("housestype"));
     $('#sell').html($.cookie("sell2"));
    $('#rental_num').val($.cookie("sell"));
     $('#houses_prices').html($.cookie("houses_prices"));
    $('#rental_num').val()!=""? $('#rental_num').val($.cookie("sell")):$('#rental_num').val("3");   
  $('#price_num').val()!=""? $('#price_num').val($.cookie("houses_prices")):$('#price_num').val("0-999999");
     var cookietime = new Date(); 
     cookietime.setTime(cookietime.getTime() + (1*30*1000));//coockie保存一分鐘 
   $(document).on('click','.search li',function(){
   
     if($(this).attr('name')=='add')
     {
    $.cookie("add", $(this).html(),{expires:cookietime}); 
     }
        else if($(this).attr('name')=='houses_prices')
     {
    $.cookie("houses_prices", $(this).html(),{expires:cookietime}); 
     }
      else   if($(this).attr('name')=='housestype')
     {
    $.cookie("housestype", $(this).html(),{expires:cookietime}); 
     }
     else if($(this).attr('name')=='sell')
     {
         $.cookie("sell", $(this).attr('data-type'),{expires:cookietime}); 
           $.cookie("sell2", $(this).html(),{expires:cookietime}); 
     }

   $('#search').submit();    
   });
   $('.tag').each(function(){
       if($(this).val()=="")
       {
           $(this).remove();
       }    
   })
})  
</script>
</body>
</html>
